<template>
	<view>
		<view class="detailed_box">
			<view class="detailed_title">
				<text>总交易</text>
				<u--text mode="date" text="2022-09-12" align="left" type="info"></u--text>
			</view>
			<view class="detailed_card">
				<text class="card">总交易(元)</text>
				<h2>17869547.89</h2>
			</view>
			<view class="detailed_list">
				<view class="detailed_list_left">
					<text>总交易</text>
					<text>我的直营</text>
					<text>仁茂清</text>
					<text>李润庭</text>
					<text>杨与人</text>
				</view>
				<view class="detailed_list_right">
					<u-collapse @change="change" @close="close" @open="open" accordion >
						<u-collapse-item>
							<text slot="title" class="color_slot">2023-05</text>
							<text slot="value" class="color_slot">￥3243432</text>
							<view class="collapse_cont" v-for="index in 19" :key="index" @click="details">
								<text>2023-09-12</text>
								<view class="">
									<text>￥3243432</text>
									<u-icon name="arrow-right" color="#eee" size="18"></u-icon>
								</view>
							</view>
						</u-collapse-item>
						<u-collapse-item>
							<text slot="title" class="color_slot">2023-04</text>
							<text slot="value" class="color_slot">￥3243432</text>
							<view class="collapse_cont">
								<text>2023-09-12</text>
								<view class="">
									<text>￥3243432</text>
									<u-icon name="arrow-right" color="#eee" size="18"></u-icon>
								</view>
							</view>
						</u-collapse-item>
						<u-collapse-item>
							<text slot="title" class="color_slot">2023-03</text>
							<text slot="value" class="color_slot">￥3243432</text>
							<view class="collapse_cont">
								<text>2023-09-12</text>
								<view class="">
									<text>￥3243432</text>
									<u-icon name="arrow-right" color="#eee" size="18"></u-icon>
								</view>
							</view>
						</u-collapse-item>
					</u-collapse>
				</view>
			</view>
		</view>

		<!-- <u-empty v-else mode="list" icon="/static/Empty/data_null.png">
		</u-empty> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				data: {},
				page: 1,
				bottom: true,
				type: null,
				time: null,
				id: ''
			}
		},
		//下拉刷新
		onReachBottom() {
			if (this.bottom == true) {
				this.page += 1
				this._List()
			}
		},
		onLoad(e) {
			this.type = e.type
			this.time = e.time
			this.id = e.id
			this._List()
		},
		methods: {
			open(e) {
				// console.log('open', e)
			},
			close(e) {
				// console.log('close', e)
			},
			change(e) {
				// console.log('change', e)
			},
			details(){
				uni.navigateTo({
					url:'/pages/data/transaction/data_details'
				})
			},
			// 页面列表展示
			async _List() {
				uni.showLoading({
					title: '加载中'
				});
				const userinfo = uni.getStorageSync('userinfo');
				const {
					data: res
				} = await this.$myHttp({
					url: 'v1/getTranList',
					data: {
						type: this.type,
						date: this.time,
						product_id: this.id,
						page: this.page,
						page_size: 15
					},
					header: {
						'token': userinfo.token
					},
				});
				if (res.code == 1) {
					if (res.data.data !== undefined && res.data.data !== null && res.data.data.length >
						0) {
						if (this.page == 1) {
							this.data = res.data
							console.log(this.data)
							uni.hideLoading()
						} else {
							this.data.data = [...this.data.data, ...res.data.data]
							uni.hideLoading()
						}
					} else {
						uni.hideLoading()
						this.bottom = false
					}
				} else {
					uni.showToast({
						title: res.msg,
						duration: 1000,
						icon: "none"
					});
					this.bottom = false
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	.detailed_box {
		padding: 20rpx;
		box-sizing: border-box;
		min-height: 94vh;
		display: flex;
		flex-direction: column;
		background-color: #f6f6f6;

		.detailed_title {
			margin-bottom: 20rpx;

			text {
				font-size: 28rpx;
				color: #333;
			}
		}

		.detailed_card {
			padding: 30rpx;
			border-radius: 15rpx;
			box-shadow: 7px 0px 30px -18px #888888;
			margin-bottom: 30rpx;
			display: flex;
			flex-direction: column;
			align-items: center;
			background-color: #fff;

			.card {
				font-size: 28rpx;
				color: #666;
			}

			h2 {
				font-weight: 500;
				font-size: 42rpx;
				margin: 20rpx 0;
			}
		}

		.detailed_list {
			.detailed_list_left {
				background-color: #fff;
				display: flex;
				flex-direction: column;
				width: 25%;
				border-radius: 15rpx;
				float: left;

				text {
					text-align: center;
					padding: 20rpx 0;
					font-size: 28rpx;
					position: relative;
				}

				text:active {
					color: #55aaff;
				}

				text:active::before {
					content: '';
					position: absolute;
					width: 5px;
					height: 50%;
					left: 0;
					background-color: #55aaff;
				}

				max-height: 65vh;
				overflow-y: auto;
			}

			.detailed_list_right {
				background-color: #fff;
				width: 70%;
				float: right;
				max-height: 65vh;
				overflow-y: auto;
				.color_slot{
					color: #333;
					font-size: 28rpx;
				}
				.collapse_cont {
					display: flex;
					justify-content: space-between;
					align-items: center;
					padding-bottom: 20rpx;
					margin-bottom: 20rpx;
					border-bottom: #f6f6f6 1px solid;
					color: #666;
					font-size: 24rpx;
					view {
						display: flex;
						align-items: center;
					}
				}
				.collapse_cont:last-child{
					margin-bottom: 0;
					border-bottom: none;
					padding-bottom: 0;
				}
			}
		}
	}
</style>